package com.prd.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.prd.config.LoginInterceptor;
import com.prd.mapper.EntMeetSummaryMotionMapper;
import com.prd.model.EntMeetSummaryMotion;
import com.prd.model.LoginUser;
import com.prd.service.EntMeetSummaryMotionService;
import com.prd.util.UserInfoUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class EntMeetSummaryMotionServiceImpl extends ServiceImpl<EntMeetSummaryMotionMapper, EntMeetSummaryMotion> implements EntMeetSummaryMotionService {

    @Autowired
    private EntMeetSummaryMotionMapper meetSummaryMotionMapper;


    @Override
    public int insertInfo(EntMeetSummaryMotion entMeetSummaryMotion) {
        LoginUser loginUser = LoginInterceptor.threadLocal.get();
        BeanUtils.copyProperties(UserInfoUtil.recordInfo(loginUser.getId(), loginUser.getName(), true), entMeetSummaryMotion);
        return meetSummaryMotionMapper.insert(entMeetSummaryMotion);
    }

    @Override
    public int updateInfo(EntMeetSummaryMotion entMeetSummaryMotion) {
        LoginUser loginUser = LoginInterceptor.threadLocal.get();
        BeanUtils.copyProperties(UserInfoUtil.recordInfo(loginUser.getId(), loginUser.getName(), false), entMeetSummaryMotion);
        return meetSummaryMotionMapper.updateById(entMeetSummaryMotion);
    }
}
